﻿namespace eg_073_类与对象
{
    internal class Employee
    {
        private int number;
        public int Number { get { return number; } }    // 员工编号公有属性
        public string Name { get; private set; }    // 姓名公有属性
        public Employee(int number, string name = "张三")
        {
            this.number = number;
            this.Name = name;
        }

        public void GetInfo()
        {
            string info = string.Format("编号:{0} 姓名:{1}", this.number, this.Name);
            Console.WriteLine(info);
        }
    }
    internal class Program
    {
        static void Main(string[] args)
        {
            Employee[] Employees = new Employee[3];
            Employees[0] = new Employee(20213213);
            Employees[1] = new Employee(12321312, "里斯");
            Employees[2] = new Employee(name: "王五", number: 2021312);
            foreach (Employee e in Employees)
            {
                e.GetInfo();
            }
        }
    }
}